#!/usr/bin/env bash

main()
{
    local cur_dir=$(pwd)
    for dir in $(ls)
    do
        if [ ! -d $dir ] ; then
            continue;
        fi

        echo "process dir: $dir"
        if [ ! -d $dir/.git ] ;then
            continue;
        fi
        cd $dir
        git branch -a  | grep remote | grep -v "\->" | awk -F '/' '{print $3}' | xargs -I {} git checkout {} ; git checkout master

        cd $cur_dir
    done
}

main ||exit 1 && exit 0;



